Developer Documentation

QuickTime 4 API Documentation

QuickTime Streaming

| Previous | Chapter Contents | Chapter Top | Next |

Locating Hint Tracks in a QuickTime Movie

In order to find the hint tracks in a QuickTime movie, you need to "walk" the atom structure of the movie. QuickTime provides an API to simplify this process, but it is relatively straightforward to do on your own if QuickTime is not available for your server's OS.

Note that all data in a movie atom structure is in big-endian format.

A QuickTime movie is made of data structures called atoms . Each atom has a header which includes its size and type. The atom's type tells you what kind of data it contains. The type field is a raw four-character string with no count byte or delimiters. The size field is a 32-bit integer. A given atom is normally identified by its byte offset within an atom structure. Adding the size of an atom to its offset will take you to the offset of the next atom in the structure.

Some atoms contain other atoms, called child atoms. The size field of an atom includes any child atoms, so you can skip an atom and all of its children in one step. If an atom contains child atoms, you can walk its internal structure, adding the size of each child atom to its offset to find the next child atom.

A QuickTime movie is an atom of type 'moov' . It contains a child atom of type 'mvhd' (the movie header), a series of 'trak' atoms (the media tracks and hint tracks), and a movie user data atom ( 'udta' ). A diagram of a typical movie atom, with two media tracks and two hint tracks, is shown below. Most of these atoms contain child atoms. The diagram is "collapsed" to show only the highest-level atoms.

Hint tracks are atoms of type 'trak' . A hint track atom contains a track header atom ( 'tkhd' ), an edits atom ('edts'), a track reference atom pointing to the track being hinted ( 'tref' ), a media atom ( 'mdia' ), and usually a track user data atom ( 'udta' ). A diagram of a typical hint track atom is shown below.

The media atom ( 'mdia' ) in a hint track contains a media handler child atom ( 'hdlr' ). Hint tracks can be identified by their media handler, which is of the generic component type 'mhlr' (bytes 12-15), component subtype 'hint' (bytes 16-19). A diagram of an 'hdlr' atom for a hint track is shown below.

To locate all the hint tracks in a movie, walk the movie to find atoms of type 'trak' . Walk the 'trak' atoms to find their 'mdia' atoms, and walk the 'mdia' atoms to find the 'hdlr' atom. Check the contents of the 'hdlr' atom for a component type of 'mhlr' and a subtype of 'hint' . Refer to the QuickTime File Format documentation for details on the structure of these atom types.


© 1998 Apple Computer, Inc.

| Previous | Chapter Contents | Chapter Top | Next |